/**
 * 访问 “用户”接口网络模块
 */
 
import axios from "./axios.config";
import util from "./util";
 
class UserApi {
  async login(data) {
    let result = await axios.post("/users/login", data);
    return util.jsonTransfer(result.data);
  }
  async logout(){
    let result = await axios.get("/users/logout");
    return util.jsonTransfer(result.data);
  }
  async find(userId) {
    let result = await axios.get(`/users/${userId}`);
    return util.jsonTransfer(result.data);
  }
  async changeProfile(user){
    let result = await axios.patch(`/users/change-info`, user);
    return util.jsonTransfer(result.data);
  }
  async checkPassword(data){
    let result = await axios.post(`/users/check-password`, data);
    return util.jsonTransfer(result.data);
  }
 
  async changePassword(data){
    let result = await axios.patch(`/users/change-password`, data);
    return util.jsonTransfer(result.data);
  }
}

export default UserApi;